﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Windows.Forms;
using NorthWin_Test.Biz;
using NorthWin_Test.Entity;

namespace NorthWin_Test.form
{
    public partial class datagird : Form
    {
        public datagird()
        {
            InitializeComponent();
            LoadData();
        }

        private void LoadData()
        {
            UserBiz biz = new UserBiz();
            foreach (UserEntity en in biz.GetAllUser())
            {
                DataGridViewRow row = new DataGridViewRow();
                DataGridViewTextBoxCell cellUserID = new DataGridViewTextBoxCell();
                cellUserID.Value = en.UserID;
                row.Cells.Add(cellUserID);
                DataGridViewTextBoxCell cellUserName = new DataGridViewTextBoxCell();
                cellUserName.Value = en.UserName;
                row.Cells.Add(cellUserName);

                DataGridViewCheckBoxCell cellChecked = new DataGridViewCheckBoxCell();
                cellChecked.Value = true;
                row.Cells.Add(cellChecked);

                DataGridViewButtonCell cellDisplay = new DataGridViewButtonCell();
                cellDisplay.Value="xem thong tin";
                row.Cells.Add(cellDisplay);
                dataGridView1.Rows.Add(row);
            }
            
        }


        

        private void dataGridView1_CellContentClick(object sender, DataGridViewCellEventArgs e)
        {
            
            
               // MessageBox.Show(dataGridView1[1,1].Value.ToString());
                dataGridView1[2, 0].ReadOnly = true;
                dataGridView1[0, 0].ReadOnly = true;
                dataGridView1[2, 1].ReadOnly = true;


                
        }

        private void dataGridView1_CellClick(object sender, DataGridViewCellEventArgs e)
        {
            MessageBox.Show(e.RowIndex.ToString());
        }

 
        
    }
}
